1 //+------------------------------------------------------------------+
2 //| Meta COT Index.mq4 |
3 //| Copyright 2009, C-4 (Vasiliy Sokolov, Russia, St.-Petersburg,|
4 //| 2009), All Rights Reserved. |
6 //+------------------------------------------------------------------+
10 #property copyright "Copyright 2009, C-4 (Vasiliy Sokolov, SPb), All Rights Reserved."
11 #property link "vs-box@mail.ru"
13 #property indicator_separate_window
14 #property indicator_buffers 4
15 #property indicator_color1 Green
16 #property indicator_color2 Blue
17 #property indicator_color3 Red
18 #property indicator_color4 Silver
20 extern int period=156;
22 extern bool Show_iNoncomm=false;
23 extern bool Show_iOperators=true;
24 extern bool Show_iNonrep=false;
25 extern bool Show_iOI=true;
27 double i_open_interest[];
36 if(init_data()==false)error=true;
37 if(error==false)load_data();
38 if(error==false)count_data();
39 //if(error==false)count_index(period);
45 if(error==true)Print(" . ");
51 SetIndexStyle(0,DRAW_LINE,0,2);
52 SetIndexStyle(1,DRAW_LINE,0,2);
53 SetIndexStyle(2,DRAW_LINE,0,2);
54 SetIndexStyle(3,DRAW_LINE,0,2);
56 SetIndexEmptyValue(0,EMPTY_VALUE);
57 SetIndexEmptyValue(1,EMPTY_VALUE);
58 SetIndexEmptyValue(2,EMPTY_VALUE);
59 SetIndexEmptyValue(3,EMPTY_VALUE);
61 SetLevelValue(1,20.0);
62 SetLevelValue(2,80.0);
63 SetLevelValue(3,100.0);
64 SetLevelStyle(0,0,Black);
65 //SetLevelStyle(0,1,Black);
66 //SetLevelStyle(0,1,Black);
67 //SetLevelStyle(0,1,Black);
68 if(load_cot_file==true)IndicatorShortName(StringConcatenate("Meta COT Index (",period,"): ",str_trim(cot_file)));
69 else IndicatorShortName(StringConcatenate("Meta COT Index (",period,"): ",name));
71 SetIndexBuffer(0,i_open_interest);
72 SetIndexLabel(0, "Open Interest");
74 if(Show_iNoncomm==true){
75 SetIndexBuffer(1,i_noncomm);
76 SetIndexLabel(1,"Index Noncommercial");
78 if(Show_iOperators==true){
79 SetIndexBuffer(2,i_operators);
80 SetIndexLabel(2,"Index Operators");
82 if(Show_iNonrep==true){
83 SetIndexBuffer(3,i_nonrep);
84 SetIndexLabel(3,"Index Nonreportable");
90 int end_data=get_lastdata();
91 for(int i=0;i<end_data;i++){
92 if(Show_iOI)i_open_interest[i]=get_data(INDEX_OI, i);
93 if(Show_iNoncomm)i_noncomm[i]=get_data(INDEX_NONCOMM, i);
94 if(Show_iOperators)i_operators[i]=get_data(INDEX_OPERATORS, i);
95 if(Show_iNonrep)i_nonrep[i]=get_data(INDEX_NONREP,i);